using System;
using System.Reflection;
using Microsoft.Office.Project.EPMAuditing.Library;
using Microsoft.Office.Project.Server.Events;
using Microsoft.Office.Project.Server.Library;

namespace Microsoft.Office.Project.EPMAuditing.EventHandlers
{
    public class LookupTableEvents : LookupTableEventReceiver
    {
        public override void OnCheckedIn(PSContextInfo contextInfo, LookupTableCheckInPostEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnCheckedOut(PSContextInfo contextInfo, LookupTableCheckOutPostEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnCheckingIn(PSContextInfo contextInfo, LookupTableCheckInPreEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnCheckingOut(PSContextInfo contextInfo, LookupTableCheckOutPreEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnCreated(PSContextInfo contextInfo, LookupTablePostEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnCreating(PSContextInfo contextInfo, LookupTablePreEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnDeleted(PSContextInfo contextInfo, LookupTableDeletePostEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnDeleting(PSContextInfo contextInfo, LookupTableDeletePreEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnUpdated(PSContextInfo contextInfo, LookupTablePostEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnUpdating(PSContextInfo contextInfo, LookupTablePreEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

    }
}
